package com.hgs.iias.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "iias_applications")
public class Application {
	public enum Status {
		SAVED,
		SUBMITTED;
		
		public String getName() {
			return name();
		}
	}
	
	public enum Type {
		APPLICATION,
		SUSPENSION;
		
		public String getName() {
			return name();
		}
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	
	@ManyToOne
	private Enterprise enterprise;
	
	@Enumerated
	@Column(nullable = false)
	private Status status;
	
	public Enterprise getEnterprise() {
		return enterprise;
	}
	
	public void setEnterprise(Enterprise enterprise) {
		this.enterprise = enterprise;
	}	
	
	public Long getId() {
		return id;
	}
	
	public void setId(Long id) {
		this.id = id;
	}
	
	public Status getStatus() {
		return status;
	}
	
	public void setStatus(Status status) {
		this.status = status;
	}
	
	public Type getType() {
		return Type.valueOf(getClass().getSimpleName().toUpperCase());
	}
}
